import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class Solution1 {
    public static int[] twoSum(int[] nums, int target) {
        int max = 2047 ; // 0111 1111 1111
        int[] test = new int[max+1] ;
        for(int i=0 ; i<nums.length ; i++) {
            int temp = target-nums[i];
            int pos = test[temp & max] ; //与运算
            if(pos!=0) return new int[] {pos-1 , i } ;
            test[nums[i]&max] = i + 1;
        }
        return null ;
    }

    public static void main(String[] args) {
        System.out.println(Arrays.toString(twoSum(new int[]{555555,444444,333333,444445}, 1000000)));
    }
}